﻿   
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script language="javascript" type="text/javascript">
    function ValidarSexo(source,args)
    {
        var txt = document.getElementById("TextBox5");
        if (txt != null && (txt.value == "F" || txt.value == "V"))
            args.IsValid = true;
        else
            args.IsValid = false;
       
    }
    </script>
    
    <div>
        <asp:Label ID="Label1" runat="server" Text="Email"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
            ErrorMessage="RegularExpressionValidator" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Direccion inválida</asp:RegularExpressionValidator>
        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br />
        Edad<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox2"
            Display="Dynamic" ErrorMessage="ingrese una edad válida" MaximumValue="110" MinimumValue="0"
            Type="Integer">Ingrese un  numero entre 0 y 110</asp:RangeValidator>
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox><br />
        <asp:Label ID="Label2" runat="server" Text="Sexo"></asp:Label>
        <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
        <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox5"
            ErrorMessage="CustomValidator" ClientValidationFunction="ValidarSexo" OnServerValidate="CustomValidator1_ServerValidate">Ingrese V o M</asp:CustomValidator><br />
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
        <asp:Label ID="Label3" runat="server" Text="Label"></asp:Label></div>

</asp:Content>